#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int cmp(char* s) {
    char* s1 = "qwertyuiopQWERTYUIOP";
    char* s2 = "asdfghjklASDFGHJKL";
    char* s3 = "zxcvbnmZXCVBNM";

    if (strchr(s1, s) != NULL) {
        return 1;
    }
    else if (strchr(s2, s) != NULL) {
        return 2;
    }
    return 3;
}
char** findWords(char** words, int wordsSize, int* returnSize) {
    char** ret = (char**)malloc(wordsSize * sizeof(char*));
    *returnSize = 0;
    for (int i = 0; i < wordsSize; i++) {
        int len = strlen(words[i]);
        int flag = cmp(words[i][0]);
        for (int j = 1; j < len; j++) {
            if (cmp(words[i][j]) != flag) {
                flag = -1;
            }
        }
        if (flag != -1) {
            ret[*returnSize] = (char*)malloc((len + 1) * sizeof(char));
            memcpy(ret[*returnSize], words[i], len + 1);
            (*returnSize)++;
        }
    }
    return ret;
}



int main()
{
	return 0;
}